var fs = require('fs');
var arr = require('./write');
var max ={name:'',num:0};

setTimeout(() => {
    console.log(arr.arr)
    console.log("-----------------------------------------------------------------------")
    console.log("正在查找最大值所在文件.....")
    for(i=1;i<=10;i++){
        fs.readFile(
            "./"+i+".txt",
            "utf8",
            (err,data)=>{
                if(err){
                    return console.log("错误信息2"+err);
                }
                if (Number(data)>=max.num){
                    max.name = "./"+arr.arr.indexOf(Number(data))+".txt";
                    max.num = data;
                }
            }
        )
    }
}, 1000);

setTimeout(function() {
    console.log("最大值文件已找到")
    console.log("------------------------------------")
    console.log(max)
    console.log("------------------------------------")
},3000)
